package Cantella::DJabberd::Web::UI::Widget::Menu;

use Reaction::UI::WidgetClass;

class Menu, which {

  implements fragment items {
    render item_layout => over $_{viewport}->ordered_items;
  };

  implements fragment maybe_selected_item {
    if( $_{viewport}->has_current_item ){
      if( $_{viewport}->current_item eq $_->name ){
        render 'selected_item';
      } else {
        render 'nonselected_item';
      }
    } else {
      render 'nonselected_item';
    }
  };

  implements fragment item {
    render 'viewport';
  }

};

1;
